package com.x.service.transactional;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.x.dao.ConfigurationDAO;

@Component("configurationService")
public class ConfigurationService {
	@Autowired
	private ConfigurationDAO configurationDAO;

	public Map<String, Object> list(int startIndex, int length,
			List<String[]> wherePart, List<String[]> odrerPart) {
		return configurationDAO.list(startIndex, length, wherePart, odrerPart);
	}

	public boolean create(String fc, String shipMethod, String province,
			String city, String district, int tt, BigDecimal shipments) {
		if (configurationDAO.notExist(fc, shipMethod, province, city, district)) {
			configurationDAO.create(fc, shipMethod, province, city, district,
					tt, shipments);
			return true;
		}
		return false;
	}

	public List<String> getProvinceSuggest() {
		return configurationDAO.getProvinceSuggest();

	}

	public List<String> getCitySuggest(String city) {
		return configurationDAO.getCitySuggest(city);
	}

	public List<String> getDistrictSuggest(String district) {
		return configurationDAO.getDistrictSuggest(district);
	}

	public void update(String id, String fc, String shipMethod,
			String province, String city, String district, int tt, BigDecimal shipments) {
		configurationDAO.update(id, fc, shipMethod, province, city, district,
				tt, shipments);

	}

	public void delete(String id) {
		configurationDAO.delete(id);
	}

	public List<Object> loadCity(String province) {
		return configurationDAO.loadCity(province);
	}

}
